package xyz.sunne.response;

import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;

import java.util.LinkedHashMap;

@NoArgsConstructor
@AllArgsConstructor
public enum ResponseCode {
    SUCCESS(0,"操作成功"),
    FAIL(1,"操作失败"),
    SYSTEM_DATA_FAIL(2,"数据操作格式异常"),
    SYSTEM_PARAM_FAIL(3,"参数错误"),
    AUTHORIZATION_EXCEPTION(4,"身份异常");
    public Integer code;

    public String msg;

    public static LinkedHashMap<Integer,String> getArrayMessage(){
        LinkedHashMap<Integer,String> responseMessages = new LinkedHashMap<>();
        for (ResponseCode statusEnum : ResponseCode.values()) {
            responseMessages.put(statusEnum.code,statusEnum.msg);
        }
        return responseMessages;
    }

}
